-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shell completion and QA #52
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The future goal is to enable manual patches to the completion files, instead of using clap_complete directly. We can use clap_complete during development, but the end user doesn't need it anymore (saving on compile time and binary size).
This is what we already did before the refactor with optional clap_complete.
My original approach was to use walkdir to list the packages, but * It requires some configuration/heuristic to find the repos * It adds a dependency on `walkdir` (though I could have reimplemented it locally) * It's actually slower than reading `emerge.log` (with 18k merges, and just the gentoo repo) * Not listing packages that have never been merged seems like a nicer behaviour Making use of this in shell completion is a work in progress, but the Rust part looks done. Tweaked docs too.
Fixes build on nightly. rust-lang/rust#125319
Most users install those files via the ebuild, and the others can ignore the files, or grab them from other sources. This simplifies the UI, and reduces the binary size by ~30k.
* Add completion for ebuild names * Add docstrings for many enums * Reduce redundant calls Fish completions are really nice to write, maybe at the cost of flexibility: I couldn't figure out how to easily complete on abbreviated commands, and I'm sometimes getting weird completions on single-letter or unknown options.
* Add completion for ebuild names * Add proper enum values * Recognize/complete abbreviated commands * Reduce redundant cases * Ignore bash version < 4 (masked in gentoo) Writing bash completions is more labor intensive, but looks less magical and ismore versatile (I got closer to ideal completion than with fish). Not supporting docstrings is a real weak point though, and the UI for selecting between a large number of options is meh.
* Add completion for ebuild names * Ignore zsh version < 5.2 (not packaged in gentoo) What a mess, zsh completion system is really complex, the docs is a wall of text, the tutorials didn't help much. The clap-generated completion was buggy. This works better now, but is not as good as bash and fish completions. I'm not a zsh user so I'll leave it at that, help welcome.
Bit of manual work needed to find that assert_cmd and predicates can't be updated due to msrv. `cargo update -Zmsrv-policy` not doing its job ? Removing adler v1.0.2 Adding adler2 v2.0.0 Updating aho-corasick v1.1.2 -> v1.1.3 Updating anstream v0.6.13 -> v0.6.15 Updating anstyle v1.0.6 -> v1.0.8 Updating anstyle-parse v0.2.3 -> v0.2.5 Updating anstyle-query v1.0.2 -> v1.1.1 Updating anstyle-wincon v3.0.2 -> v3.0.4 Updating anyhow v1.0.80 -> v1.0.87 Updating autocfg v1.1.0 -> v1.3.0 Updating bstr v1.9.1 -> v1.10.0 Updating colorchoice v1.0.0 -> v1.0.2 Updating crc32fast v1.4.0 -> v1.4.2 Updating crossbeam-channel v0.5.12 -> v0.5.13 Updating crossbeam-utils v0.8.19 -> v0.8.20 Updating env_filter v0.1.0 -> v0.1.2 Updating env_logger v0.11.2 -> v0.11.5 Updating flate2 v1.0.28 -> v1.0.33 Adding float-cmp v0.9.0 Updating hashbrown v0.14.3 -> v0.14.5 Updating indexmap v2.2.5 -> v2.5.0 Adding is_terminal_polyfill v1.70.1 Updating itoa v1.0.10 -> v1.0.11 Updating libc v0.2.153 -> v0.2.158 Updating log v0.4.21 -> v0.4.22 Updating memchr v2.7.1 -> v2.7.4 Updating miniz_oxide v0.7.2 -> v0.8.0 Adding normalize-line-endings v0.3.0 Updating num-traits v0.2.18 -> v0.2.19 Updating proc-macro2 v1.0.78 -> v1.0.86 Updating quote v1.0.35 -> v1.0.37 Updating regex v1.10.3 -> v1.10.6 Updating regex-automata v0.4.6 -> v0.4.7 Updating regex-syntax v0.8.2 -> v0.8.4 Updating ryu v1.0.17 -> v1.0.18 Updating serde v1.0.197 -> v1.0.210 Updating serde_derive v1.0.197 -> v1.0.210 Updating serde_json v1.0.114 -> v1.0.128 Updating serde_spanned v0.6.5 -> v0.6.7 Updating syn v2.0.52 -> v2.0.77 Updating thiserror v1.0.57 -> v1.0.63 Updating thiserror-impl v1.0.57 -> v1.0.63 Updating toml v0.8.10 -> v0.8.19 Updating toml_datetime v0.6.5 -> v0.6.8 Updating toml_edit v0.22.6 -> v0.22.20 Updating utf8parse v0.2.1 -> v0.2.2 Updating windows-targets v0.52.4 -> v0.52.6 Updating windows_aarch64_gnullvm v0.52.4 -> v0.52.6 Updating windows_aarch64_msvc v0.52.4 -> v0.52.6 Updating windows_i686_gnu v0.52.4 -> v0.52.6 Adding windows_i686_gnullvm v0.52.6 Updating windows_i686_msvc v0.52.4 -> v0.52.6 Updating windows_x86_64_gnu v0.52.4 -> v0.52.6 Updating windows_x86_64_gnullvm v0.52.4 -> v0.52.6 Updating windows_x86_64_msvc v0.52.4 -> v0.52.6 Updating winnow v0.6.5 -> v0.6.18
dbb71f4
to
12cc703
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.